package biz.obake.team.touchprotector.g;

import biz.obake.team.touchprotector.f.i;
import biz.obake.team.touchprotector.notice.Notice;
import biz.obake.team.touchprotector.tpas.TPAccessibilityService;
import biz.obake.team.touchprotector.tpservice.TPService;
import biz.obake.team.touchprotector.ui.MainActivity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class c {

    /* renamed from: a  reason: collision with root package name */
    private static final Map<String, String> f1707a = new a();

    /* renamed from: b  reason: collision with root package name */
    private static Map<String, String> f1708b = new HashMap();

    /* renamed from: c  reason: collision with root package name */
    private static List<b> f1709c = new ArrayList();

    static class a extends HashMap<String, String> {
        a() {
            TPService.h(this);
            TPAccessibilityService.h(this);
            i.g(this);
            MainActivity.M(this);
            Notice.initRamPrefs(this);
            biz.obake.team.touchprotector.donation.a.s(this);
            biz.obake.team.touchprotector.d.d.a.d(this);
            biz.obake.team.touchprotector.d.h.b.b(this);
            biz.obake.team.touchprotector.d.i.b.a(this);
            biz.obake.team.touchprotector.d.g.b.e(this);
            biz.obake.team.touchprotector.features.proximity.b.d(this);
            biz.obake.team.touchprotector.features.proximity.a.d(this);
            biz.obake.team.touchprotector.features.proximity.c.d(this);
            biz.obake.team.touchprotector.features.shake.b.d(this);
            biz.obake.team.touchprotector.features.upsidedown.b.d(this);
            biz.obake.team.touchprotector.features.upsidedown.a.c(this);
        }
    }

    public interface b {
        void onRamPrefsChanged(String str);
    }

    public static synchronized boolean a(String str) {
        boolean containsKey;
        synchronized (c.class) {
            containsKey = f1707a.containsKey(str);
        }
        return containsKey;
    }

    public static synchronized boolean b(String str) {
        boolean equals;
        synchronized (c.class) {
            if (a(str)) {
                String str2 = f1708b.get(str);
                if (str2 == null) {
                    str2 = f1707a.get(str);
                }
                equals = "true".equals(str2);
            } else {
                throw new b("{7F380D88-321F-461A-8080-009F89DC08A1}", str);
            }
        }
        return equals;
    }

    public static synchronized String c(String str) {
        String str2;
        synchronized (c.class) {
            if (a(str)) {
                str2 = f1708b.get(str);
                if (str2 == null) {
                    str2 = f1707a.get(str);
                }
            } else {
                throw new b("{53D9E10F-80CE-498A-A70D-49725C20564D}", str);
            }
        }
        return str2;
    }

    private static void d(String str) {
        for (int i = 0; i < f1709c.size(); i++) {
            f1709c.get(i).onRamPrefsChanged(str);
        }
    }

    public static void e(b bVar) {
        if (!f1709c.contains(bVar)) {
            f1709c.add(bVar);
        }
    }

    public static synchronized void f(String str, boolean z) {
        synchronized (c.class) {
            if (a(str)) {
                f1708b.put(str, z ? "true" : "false");
                d(str);
            } else {
                throw new b("{8D4E190E-12F5-4E52-80E2-9F11BBE7FB45}", str);
            }
        }
    }

    public static synchronized void g(String str, String str2) {
        synchronized (c.class) {
            if (a(str)) {
                f1708b.put(str, str2);
                d(str);
            } else {
                throw new b("{D059ABDA-F8FA-45D6-A454-B338F08E5CB1}", str);
            }
        }
    }

    public static void h(b bVar) {
        if (f1709c.contains(bVar)) {
            f1709c.remove(bVar);
        }
    }
}
